package com.tien.model;

import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Proxy;

/**
 * 
 * @author Tian
 * @Mail tianxin_star@163.com
 * @version date：Mar 15, 2012 1:21:40 PM
 * 
 */
@Entity
@Table(name = "GROUPS")   
@Proxy(lazy = false)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Group implements java.io.Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -6681186119673234339L;
	@Id
	@GeneratedValue
	private Long id;
	private String group_name;
	private String group_desc;
	private String group_type;
	@ManyToMany(targetEntity = Menu.class, fetch = FetchType.EAGER)
	@JoinTable(name = "MENUS_GROUPS", joinColumns = @JoinColumn(name = "GROUP_ID"), inverseJoinColumns = @JoinColumn(name = "MENU_ID"))
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	private Set<Menu> menus;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getGroup_name() {
		return group_name;
	}

	public void setGroup_name(String group_name) {
		this.group_name = group_name;
	}

	public String getGroup_desc() {
		return group_desc;
	}

	public void setGroup_desc(String group_desc) {
		this.group_desc = group_desc;
	}

	public String getGroup_type() {
		return group_type;
	}

	public void setGroup_type(String group_type) {
		this.group_type = group_type;
	}

	public Set<Menu> getMenus() {
		return menus;
	}

	public void setMenus(Set<Menu> menus) {
		this.menus = menus;
	}
}
